from tkinter import *
import requests
from tkinter.filedialog import askopenfilename
from tkinter.messagebox import showinfo
frameT = Tk()
frameT.geometry('600x200+400+200')
frameT.title('选择需要输入处理的文件')

frame_Host = Frame(frameT).pack(padx=10, pady=10)  # 设置外边距
frame_Out = Frame(frameT).pack(padx=10, pady=10)  # 设置外边距
frame_frequency = Frame(frameT).pack(padx=10, pady=10)
frame_cmd = Frame(frameT).pack(padx=10, pady=10)
frame_exit  = Frame(frameT).pack(padx=10, pady=10)
#定义输入框类型
Host_file = StringVar()
Out_file = StringVar()
Test_frequency = IntVar()
Entry(frame_Host, width=50, textvariable=Host_file).pack(fill=X, side=LEFT)  # x方向填充,靠左
Entry(frame_Out, width=50, textvariable=Out_file).pack(fill=X, side=LEFT)  # x方向填充,靠左
Entry(frame_frequency, width=50, textvariable=Out_file).pack(fill=X, side=LEFT)  # x方向填充,靠左)

def fileopen():
    file_sql = askopenfilename()
    if file_sql:
        Host_file.set(file_sql)

def fileopen_1():
    file_YuD = askopenfilename()
    if file_YuD:
        Out_file.set(file_YuD)

def match():
    print(Host_file.get(), Out_file.get())
    pass

Button(frame_Host, width=20, text='主机列表文件', font=("宋体", 14), command=fileopen).pack(fil=X, padx=10)
Button(frame_Out, width=20, text='测试输出文件', font=("宋体", 14), command=fileopen_1).pack(fil=X, padx=10)
Button(frame_cmd, width=10, text='运行', font=("宋体", 14), command=match).pack(fill=X, side=LEFT)
Button(frame_exit, width=10, text='退出', font=("宋体", 14), command=frameT.quit).pack(fill=Y, padx=10)
frameT.mainloop()
